package com.yixincaipiao;

import android.view.View;
import android.widget.TextView;

import com.android.volley.VolleyError;
import com.yixincaipiao.base.BaseActivity;
import com.yixincaipiao.network.Http;
import com.yixincaipiao.network.NetRequest;
import com.yixincaipiao.network.Page;
import com.yixincaipiao.utils.L;
import com.yixincaipiao.weight.Dialogs;

/**
 * 框架使用activity
 */
public class MainActivity extends BaseActivity {

    @Override
    protected void initView() {
        setContentView(R.layout.activity_main);
        findViewById(R.id.tv_click).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                getData();
//                Dialogs.getWaitDialog(MainActivity.this).show();
                Dialogs.getWaitDialog(MainActivity.this, 0, "请稍后...").show();
            }
        });
        //测试使用dialog
//        Dialogs.getCustomDialog(this, R.layout.use_custum_dialog, new Dialogs.BindEventView() {
//            @Override
//            public void bindEventView(View v) {
//                TextView tvTitle = (TextView) v.findViewById(R.id.tv_mtitle);
//                tvTitle.setText("测试数据");
//            }
//        }).show();
//        Page
    }

    @Override
    protected void onResume() {
        super.onResume();
//        getData();

    }

    @Override
    protected void getData() {
//        String myUrl = "https://wikipedia.org";
//        String myUrl = "https://certs.cac.washington.edu/CAtest/";
        String myUrl = "http://www.geeboo.com/library/cGetMyLibBookAction.go?email=12345aaa6@qq.com&nowPage=1&password=2139013067J6HB44B6C9&versionNumber=312&terminalType=1&accountId=19261";

        Http.aSyncGet(this, Dialogs.getWaitDialog(this), myUrl, null, new NetRequest.NetRequestListener() {
            @Override
            public void onAccessComplete(boolean success, String object, VolleyError error, String flag) {
                L.i("data   " + object);
            }
        });
    }

}
